home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Carousel
/
CAROUSEL.cdr
/
mactosh
/
util
/
simulare.sit
/
Simula 4.07 Reference
/
card_32446.txt
< prev
next >
Wrap
Text File
|
1989-05-02
|
2KB
|
103 lines
-- card: 32446 from stack: in.07 Reference
-- bmap block id: 0
-- flags: 0000
-- background id: 13647
-- name:
-- part 1 (field)
-- low flags: 00
-- high flags: 0002
-- rect: left=346 top=49 right=162 bottom=496
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 0
-- font id: 3
-- text size: 9
-- style flags: 0
-- line height: 12
-- part name:
-- part 2 (field)
-- low flags: 00
-- high flags: 0002
-- rect: left=346 top=165 right=289 bottom=496
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 0
-- font id: 3
-- text size: 9
-- style flags: 0
-- line height: 12
-- part name:
-- part 3 (button)
-- low flags: 00
-- high flags: A004
-- rect: left=294 top=291 right=313 bottom=378
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: Continue
----- HyperTalk script -----
on mouseUp
go to card id 32887
end mouseUp
-- part contents for background part 2
----- text -----
Types - Text variables cont.
-- part contents for background part 1
----- text -----
The attributes of a text variable can be accessed
with a number of operations:
The POS indicator:
T.LENGTH returns the number of characters in T,
=0 for Notext.
T.SETPOS(n); will set the POS indicator to N,
or Lenght+1 if N>Length.
T.POS returns the Pos indicator.
T.MORE returns true if T.POS<=T.LENGTH.
Access individual characters:
T.GETCHAR returns the character at Pos
and increments Pos.
T.PUTCHAR deposits a character at Pos
and increments Pos.
-- part contents for card part 1
----- text -----
! Exercise 1;
Text t1,t2;
t2:-copy(t1);
! could be code as;
t2:-blanks(t1.length);
t1.setpos(1);
while t1.more do
t2.putchar(t1.getchar);
t2.setpos(1);
-- part contents for card part 2
----- text -----
! Exercise 2;
Text t1,t2;
t2:=t1;
! could be coded as;
t1.setpos(1); t2.setpos(1);
while t1.more do
t2.putchar(t1.getchar);
while t2.more do
t2.putchar(' ');
t2.setpos(1);